﻿using Confluent.Kafka;
using System;
using System.Threading.Tasks;

namespace ProducerTest1
{
    class Program
    {
        static async Task Main(string[] args)
        {
            ProducerConfig config = new ProducerConfig { BootstrapServers = "192.168.3.68:9092,192.168.3.66:9092,192.168.3.69:9092" };
            //ProducerConfig config = new ProducerConfig { BootstrapServers = "192.168.0.106:9092,192.168.0.105:9092,192.168.0.107:9092" };
            //ProducerConfig config = new ProducerConfig { BootstrapServers = "192.168.3.68:9092" };
            ////这是一条一条的推送使用的方式，这种方式每条消息推送之间会有几毫秒的间隔
            //IPush push = new SinglePush();
            //await push.InvokeAsync(config);

            ////这是批量推送的方式
            //IPush push = new BathPush();
            //push.Invoke(config);

            //IPush push = new AvroSpecificProducer("http://192.168.3.68:8081", "cusavroschemaserializer");
            //await push.InvokeAsync(config);

            //IPush push = new AvroGenericProducer("http://192.168.3.68:8081", "cusavroschemaserializer");
            //await push.InvokeAsync(config);

            //IPush push = new BananaPartitioner();
            //await push.InvokeAsync(config);

            IPush push = new AvroSpecificPartitionProducer("http://192.168.3.68:8081", "staticconsumer");
            await push.InvokeAsync(config);
            
            Console.WriteLine("Hello World!");
            Console.ReadKey();
        }
    }
}
